<template>
  <div class="login-wrap">
    <el-form class="login-container">
      <h1 class="title">用户注册</h1>
      <el-form-item label="">
        <el-input type="text" placeholder="用户账号" v-model="username" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="">
        <el-input type="password" placeholder="用户密码" v-model="password" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="">
        <el-input type="password" placeholder="确认密码" v-model="password1" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="doRegister()" style="width: 48%;">用户注册</el-button>
        <el-button style="width: 47%" @click="gotoLogin">返回登陆</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
/*  import axios from 'axios'
  import qs from 'qs' */
export default{
  name: "register",
  data: function () {
    return {
      username: null,
      password: null,
      password1: null
    }
  },
  methods: {
    doRegister: function () {
      let form = {
        username:this.username,
        password: this.password,
      }
      this.$http.userLogin.register(form).then(result=>{
        if (result.code==2000) this.$router.push("/Login")
      })
    },
    gotoLogin: function () {
      this.$router.push("/Login")
    },
    doLogin: function () {


      let params = {
        username: this.username,
        password: this.password,
        methodName: "userLogin"
      }
      console.log(params)

      this.axios.get(this.axios.urls.SYSTEM_USER_DOLOGIN, {
        params: params
      }).then(resp => {
        console.log(resp.data)
      }).catch(resp => {})

      /* this.axios.post(this.axios.urls.SYSTEM_USER_DOLOGIN
      ,params).then(resp => {
          console.log(resp.data);
      }).catch(resp=>{}); */
    }
  }
}
</script>

<style scoped="scoped">
.login-wrap {
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  padding-top: 10%;
  background-image: url();
  /* background-color: #112346; */
  background-repeat: no-repeat;
  background-position: center right;
  background-size: 100%;
}

.login-container {
  border-radius: 10px;
  margin: 0px auto;
  width: 350px;
  padding: 30px 35px 15px 35px;
  background: #fff;
  border: 1px solid #eaeaea;
  text-align: left;
  box-shadow: 0 0 20px 2px rgba(0, 0, 0, 0.1);
}

.title {
  margin: 0px auto 40px auto;
  text-align: center;
  color: #505458;
}
</style>

